package com.shenyong.controller;

import com.shenyong.entity.LoginUsers;
import com.shenyong.service.UserService;
import com.shenyong.util.JwtToken;
import com.shenyong.util.JwtUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author
 * @site
 * @company
 * @create
 */
@RestController
public class BaseController {
    @Autowired
    private UserService userService;
    public String token;

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }
    public String username(){
        return JwtUtil.getUsername(token);
    }
    public LoginUsers user(){
       return userService.getName(user().getUser().getUser_username());
    }
}
